class Solution {
    //判断回文串
    public boolean isPalindrome(String s) {
        s.toLowerCase();
        int left=0;
        int right=s.length()-1;
        while(left<right){
            while(left<right&&!isValidChar(s.charAt(left))){
                left++;
            }
            while(left<right&&!isValidChar(s.charAt(right))){
                right--;
            }

            if(s.charAt(left)!=s.charAt(right)){
                return false;
            }else{
                left++;
                right--;
            }
        }
        return true;

    }

    private boolean isValidChar(char ch){

        if(Character.isDigit(ch)||Character.isLetter(ch)){
            return true;
        }
        return false;
    }
}